//
//  LKAnalyticesNotificationController.m
//  LKAnalytics
//
//  Created by Eric MiAo on 16/9/9.
//  Copyright © 2016年 MiAo. All rights reserved.
//

#import "LKAnalyticesNotificationController.h"

@interface LKAnalyticesNotificationController ()

@end

@implementation LKAnalyticesNotificationController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor redColor];
    self.view.alpha = 0;

    [self addLKAnalyticesNotification:self.info];
}

- (void)addLKAnalyticesNotification:(NSDictionary *)info {
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appExit) name:UIApplicationWillResignActiveNotification object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appEnter) name:UIApplicationDidBecomeActiveNotification object:nil];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appEnd) name:UIApplicationWillTerminateNotification object:nil];
}

- (void)appEnter {
    [self.delegate LKAnalyticesNotificationControllerReceive:101 :self.info];
//    NSLog(@"enter");
}

- (void)appExit {
    [self.delegate LKAnalyticesNotificationControllerReceive:102 :self.info];
//    NSLog(@"exit");
}

- (void)appEnd {
    [self.delegate LKAnalyticesNotificationControllerReceive:103 :self.info];
//    NSLog(@"end");
}

@end
